<?php
/**
 * Created by PhpStorm.
 * User: 764432054@qq.com
 * Date: 2019/2/22
 * Time: 22:28
 */
$client= new swoole_client(SWOOLE_SOCK_TCP);

if(!$client->connect("127.0.0.1",9501)){
    exit("connect fail");
}
while(true){
    begin:
    fwrite(STDOUT,"please input msg:");

    $msg=trim(fgets(STDIN));
    if(empty($msg)){
        goto begin;
    }

    $client->send($msg);


    $result=$client->recv();
    echo $result.PHP_EOL;
}
